<?php
header("content-type:text/html;charset=utf8");
// print_r($_POST);
$username = $_POST["username"];
$password = $_POST["password"];
$email = $_POST["email"];
$tel = $_POST["tel"];

// 连接数据库
$con = mysqli_connect('127.0.0.1','root','1997','bk2110',3306);
$res = mysqli_query($con,"select * from zhuce where username='$username'");
$row = mysqli_fetch_assoc($res);
if($row){
    echo 2;//用户名被占用
}else{
    $bool = mysqli_query($con,"insert zhuce(username,password,email,tel) values('$username','$password','$email',$tel)");
    if($bool){
        echo 1;//插入成功
    }else{
        echo 3;
    }
}